package by.scsbsu.resources.managers;

import java.util.ResourceBundle;


public class MessageManager {
	
	public static final String INFO_MESSAGES_BUNDLE =  "by.scsbsu.resources.info_messages";
	
	//Page titles
	public static final String MAIN_PAGE_TITLE = "MAIN_PAGE_TITLE";

	//Servlet messages
    public static final String LOGIN_ERROR_MESSAGE = "LOGIN_ERROR_MESSAGE";
    public static final String SERVLET_EXCEPTION_ERROR_MESSAGE = "SERVLET_EXCEPTION_ERROR_MESSAGE";
    public static final String IO_EXCEPTION_ERROR_MESSAGE = "IO_EXCEPTION_ERROR_MESSAGE";
    
    //FileUploader messages
    public static final String FILE_SIZE_ERROR = "FILE_SIZE_ERROR";
    public static final String FILE_TYPE_ERROR = "FILE_TYPE_ERROR";

    private static ResourceBundle resourceBundle = null;
    
    public static ResourceBundle getBundle() {
        if (resourceBundle == null) {
        	MessageManager.resourceBundle = 
        		ResourceBundle.getBundle(INFO_MESSAGES_BUNDLE);
        }
        return resourceBundle;
    }

    public static String getProperty(String key) {
    	resourceBundle = getBundle();
        return resourceBundle.getString(key);
    }
}
